/**
 * 项目名：五位一体化工安全信息平台
 * 日期：    2019-12-07 13:44:18
 * Copyright (c) 2015- joysuch-版权所有
 */

package com.joysuch.wwyt.app.controller;

import com.joysuch.wwyt.bp.bean.BpEmergencyPeopleBean;
import com.joysuch.wwyt.bp.service.BpEmergencyContingencyPlanService;
import com.joysuch.wwyt.core.common.ajax.ResultBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 应急消防管理——预案
 */
@RestController
@RequestMapping("/bp/app/bp-emergency-contingency-plan")
@Api(tags = "app 应急消防队伍")
public class AppEmergencyContingencyPlanController {

    private static final Logger logger = LoggerFactory.getLogger(AppEmergencyContingencyPlanController.class);

    @Autowired
    private BpEmergencyContingencyPlanService bpEmergencyContingencyPlanService;


    @GetMapping("/pagePeople")
    @ApiOperation(value = "分页展示应急人员")
    public ResultBean pagePeople(Pageable page, BpEmergencyPeopleBean.SearchPlanBean condition) {
        try {
            Page<BpEmergencyPeopleBean> data = bpEmergencyContingencyPlanService.pagePeople(page, condition);
            return ResultBean.pageData(data.getContent(), data.getTotalElements());
        } catch (Exception e) {
            logger.error("分页查询失败", e);
            return ResultBean.fail(101, "分页查询失败");
        }
    }

}
